package app.netant.book.kyxsw;

import org.jsoup.select.Elements;

import app.netant.book.base.BaseDetail;
/**
 * 
 * @author JiaJ
 *
 */
public class KyxswDetail extends BaseDetail {

	public KyxswDetail(String netSite) {
		super(netSite);
		this.preHref = "https://www.kyxsw.cc";
	}

	@Override
	public void analyseTitle() {
		Elements parts = this.select(".kfml .infot h1");
		if(parts.size()>0){
			String title = parts.get(0).text();
			System.out.println("【Title】:"+title);
			this.entity.setNovelName(title);
			this.entity.setNovelFullName(title+".txt");
		}
		Elements parts1 = this.select(".kfml .infot span");
		if(parts1.size()>0){
			String writer = parts1.get(0).text().trim();
			if(writer.endsWith("/著")){
				writer = writer.substring(0,writer.length()-2);				
			}
			System.out.println("【Writer】:"+writer);
			this.entity.setNovelWriter(writer);
		}
	}

	@Override
	public void analyseTags() {
		
	}

	@Override
	public void analyseMemo() {
		
	}

	@Override
	public void analyseHref() {
		Elements parts = this.select(".kfml .infot a");
		for(int i=0;i<parts.size();i++){
			String text = parts.get(i).text();
			if(text.indexOf("下载")>0){
				String href = parts.get(i).attr("href");
				System.out.println("【Href】:"+href);
				this.entity.setDownPath(href);
			}
		}
	}
	
	@Override
	public void analyseType() {
		
	}
	
	public static void main(String[] args) {
		KyxswDetail detail = new KyxswDetail("https://www.kyxsw.cc/book/112/112359/index.html");
		detail.test();
	}



}
